<!doctype html>
<html>
	<head>
		<title>银行卡注册</title>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<link rel="stylesheet" href="css/applydebitcard-style.css">
		<link rel="stylesheet" href="admin-html/css/layer.css">
		<link rel="stylesheet" href="admin-html/lib/layui/css/layui.css">
	</head>
	
	<body class="bg-cyan">
		<div class="body body-s">		
			<form action="" id="sky-form" class="sky-form">
				<header>填写借记卡注册信息</header>
				<fieldset>					
					<section>
						<label class="input">
							<i class="icon-append icon-user"></i>
							<input type="text" id="phonenum" name="phonenumber" placeholder="电话号码">
							<b class="tooltip tooltip-bottom-right">Needed to enter your phonenumber</b>
						</label>
					</section>
					
					<section>
						<label class="input">
							<i class="icon-append icon-envelope-alt"></i>
							<input type="email" id="email" name="email" placeholder="电子邮箱">
							<b class="tooltip tooltip-bottom-right">Needed to verify your E-mail</b>
						</label>
					</section>

					<section>
						<label class="input">
							<i class="icon-append icon-lock"></i>
							<input type="text" id="idnum" name="idnumber" placeholder="身份证号码">
							<b class="tooltip tooltip-bottom-right">Needed to enter your IDnumber</b>
						</label>
					</section>

					<section>
						<label class="input">
							<i class="icon-append icon-lock"></i>
							<input type="password" id="password" name="password" placeholder="密码">
							<b class="tooltip tooltip-bottom-right">Needed to enter your Password</b>
						</label>
					</section>
				</fieldset>
					
				<fieldset>
					<section>
						<label class="select">
							<select name="gender" id="sex">
								<option value="0" selected disabled>--请选择性别--(Gender)</option>
								<option value="1">男 (Male)</option>
								<option value="2">女 (Female)</option>
							</select>
							<i></i>
						</label>
					</section>
				</fieldset>
				<footer>
					<button type="button" class="button" onclick="apply_card()">提  交</button>
				</footer>
			</form>			
		</div>
	<script src="js/jquery.js"></script>
	<script src="admin-html/lay/modules/layer.js"></script>
	<script src="admin-html/lib/layui/layui.js"></script>
	<script type="text/javascript">
		function apply_card() {
			var msg = layer.msg('提交中...', {icon: 16,time: 0});
			var phonenum = $("#phonenum").val();
			var email = $("#email").val();
			var password = $("#password").val();
			var certificatenum = $("#idnum").val();
			var sex = $("#sex").val();
			var data={
				"cardtypeid":"1",
				"password":password,
				"certificatetype":"身份证",
				"certificatenum":certificatenum,
				"fixphone":phonenum,
				"sex":sex,
				"phonenum":phonenum,
				"email":email,
				"address":"重庆市南岸区"
			}
			$.ajax({
				url:"http://www.longm.top:8080/lm/Card/Apply",
				type: "post",
				dataType: 'json',
				headers:{
					'Content-Type':'application/json',
					"token":window.localStorage.getItem("token")
				},
				data: JSON.stringify(data),
				contentType: "application/x-www-form-urlencoded",
				success: function (result) {
					console.log(JSON.stringify(result));
					if(result.code === 200){
						layer.close(msg);
						layer.msg(result["message"]}
						window.location.href="bankcardlist.html";
					} else {
						layer.close(msg);
						layer.msg(result["message"]}
	}
				}
			});
		}
	</script>
	</body>
</html>